/*************************************************************************
	> File Name: P1540.cpp
	> Author: 
	> Mail: 
	> Created Time: 
 ************************************************************************/
#include <iostream>
#include <queue>
using namespace std;
queue<int> mem;
int Hash[1005] = {0};

int main() {
    int m, n; cin >> m >> n;
    int cnt = 0;
    while (n--) {
        int en; cin >> en;
        if (Hash[en]) continue;
        ++cnt;
        mem.push(en);
        Hash[en] = 1;
        while (mem.size() > m) {
            Hash[mem.front()] = 0;
            mem.pop();
        }
    }
    cout << cnt << endl;
    return 0;
}
